package com.study.springboottest.thread;

public class ThreadTest implements Runnable {

    private static int count;

    public static void main(String[] args) {
        ThreadTest threadTest = new ThreadTest();
        Thread threadA = new Thread(threadTest);
        Thread threadB = new Thread(threadTest);
        threadA.setName("A");
        threadB.setName("B");
        threadA.start();
        threadB.start();
    }

    @Override
    public synchronized void run() {
        for (int i = 0; i < 10000; i++) {
            count++;
            System.out.println(count);
        }
    }
}
